import request from '@/utils/request'

// 获取平台类型列表
export function getAppTypeList() {
  return request({
    url: '/basic/app/management/appTypeList',
    method: 'get'
  })
}

// 获取应用管理下拉列表
export function getDropdownList() {
  return request({
    url: '/basic/app/management/dropdownList',
    method: 'get'
  })
}

// 查询应用管理列表
export function listAppManagement(params) {
  return request({
    url: '/basic/app/management/list',
    method: 'get',
    params
  })
}

// 导出应用管理列表
export function exportAppManagement(params) {
  return request({
    url: '/basic/app/management/export',
    method: 'post',
    params,
    responseType: 'blob'
  })
}

// 获取应用管理详细信息
export function getAppManagementDetail(id) {
  return request({
    url: `/basic/app/management/${id}`,
    method: 'get'
  })
}

// 新增应用管理
export function addAppManagement(data) {
  return request({
    url: '/basic/app/management',
    method: 'post',
    data
  })
}

// 修改应用信息
export function updateAppInfo(data) {
  return request({
    url: '/basic/app/management/edit/currentAppInfo',
    method: 'put',
    data
  })
}

// 发布应用版本
export function pushAppVersion(data) {
  return request({
    url: '/basic/app/management/pushVersion',
    method: 'put',
    data
  })
}

// 查看历史记录
export function getAppHistory(applicationId) {
  return request({
    url: `/basic/app/management/history/${applicationId}`,
    method: 'get'
  })
}

// 删除应用管理
export function deleteAppManagement(ids) {
  return request({
    url: `/basic/app/management/${ids}`,
    method: 'delete'
  })
}